package com.cssy.yd.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.yd.logic.dao.LogicPoReturnDAO;
import com.cssy.yd.logic.entity.LogicPoReturnDO;
import com.plat.helper.SearchConditions;

/**
 * ��ݷ��ʶ���ʵ����
 * @since 2013-07-29
 */
public class LogicPoReturnDAOImpl extends SqlMapClientDaoSupport implements LogicPoReturnDAO {

    /**
     * �������
     * @param logicPoReturnDO
     * @return ������ݵ�����
     */
    public String insertLogicPoReturnDO(LogicPoReturnDO logicPoReturnDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicPoReturn.insert", logicPoReturnDO);
        return (String) id;
    }

    /**
     * ͳ�Ƽ�¼��
     * @param logicPoReturnDO
     * @return ����ļ�¼��
     */
    public Integer countLogicPoReturnDOByExample(LogicPoReturnDO logicPoReturnDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoReturn.countByDOExample", logicPoReturnDO);
        return count;
    }

    /**
     * ���¼�¼
     * @param logicPoReturnDO
     * @return ��Ӱ�������
     */
    public Integer updateLogicPoReturnDO(LogicPoReturnDO logicPoReturnDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicPoReturn.update", logicPoReturnDO);
        return result;
    }

    /**
     * ��ȡ�����б�
     * @param logicPoReturnDO
     * @return �����б�
     */
    @SuppressWarnings("unchecked")
    public List<LogicPoReturnDO> findListByExample(LogicPoReturnDO logicPoReturnDO) throws DataAccessException {
        List<LogicPoReturnDO> list = getSqlMapClientTemplate().queryForList("LogicPoReturn.findListByDO", logicPoReturnDO);
        return list;
    }

    /**
     * ��������ȡlogicPoReturnDO
     * @param id
     * @return logicPoReturnDO
     */
    public LogicPoReturnDO findLogicPoReturnDOByPrimaryKey(String id) throws DataAccessException {
        LogicPoReturnDO logicPoReturnDO = (LogicPoReturnDO) getSqlMapClientTemplate().queryForObject("LogicPoReturn.findByPrimaryKey", id);
        return logicPoReturnDO;
    }

    /**
     * ɾ���¼
     * @param id
     * @return ��Ӱ�������
     */
    public Integer deleteLogicPoReturnDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicPoReturn.deleteByPrimaryKey", id);
        return rows;
    }
    
    @Override
    public List<LogicPoReturnDO> find(SearchConditions scs) throws DataAccessException{
		List<LogicPoReturnDO> list = getSqlMapClientTemplate().queryForList("LogicPoReturn_ex.find", scs);
   		   return list;
    }
    
	@Override
    public Integer count(SearchConditions scs) throws DataAccessException {		
		 Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoReturn_ex.count", scs);
  	      return count;
  	}

	@Override
	public Integer untreatedPoreturncode(Map<String, Object> map)
			throws DataAccessException {
		 Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPoReturn_ex.untreatedPoreturncode", map);
 	      return count;
	}

}